{include file="public/header"}
<link href="__TEMPLATE__/mobile/index/css/login.css" rel="stylesheet" type="text/css">
<link href="__TEMPLATE__/sysme/css/layer.css" rel="stylesheet" type="text/css" />
<link href="__TEMPLATE__/mobile/index/css/pulic.css" rel="stylesheet" type="text/css">
<script src="__TEMPLATE__/sysme/js/layer.js" type="text/javascript"></script>
</head>
<style type="text/css">
   #tsk{width:200px;height:150px;display:none;background:#fff;position:absolute;top:200px;left:50%;margin-left:-100px;border-radius: 5px;text-align: center;font-size:14px;z-index: 1111;}
    #ts{width:60px;height:30px;position:absolute;bottom:10px;left:50%;margin-left:-25px;background:#e7aea6;line-height:30px;border-radius: 4px;color:#fff;}
    #tsk p{width:160px;height:70px;position:absolute;top:0;right:0;left:0;bottom:0;margin:auto;text-align: center;color:#f00;font-weight:bold;padding: 0px 20px 10px;}
	 #reveal-left {
    background: url(__TEMPLATE__/mobile/index/img/blank_01.png) no-repeat;
    background-size: 42.5px;
    height: 44px;
    width: 42.5px;
    height: 44px;
    display: block;
    border: none; 
}
.biaoda1 {
    border-radius: 0px 0px 5px 5px;
    margin: 0 7px;
}



.tb_input{position:relative;width:100%;}
.tb_input input{padding-left:0;text-indent:10px;}
.tb_input span{width:145px;height:42px;position:absolute;right:-25px;top:0;display:none;line-height:42px;color:red;font-size:12px;background:#fff;text-align: center;font-weight: bold;}

.ind {
    margin-top: 12px;
}
.tb_input .change_h::-webkit-input-placeholder {
                color: red;
                font-size:14px;
 }
.tb_input .change_q::-webkit-input-placeholder {
                color: gray;
 }
 .tb_input {
    position: relative;
    width: 88%;
    border-bottom: 1px solid #e5e5e5;
}
.tb_input input {
    padding-left: 0;
    text-indent: 10px;
    margin-top: -1px;
}

 input::-webkit-input-placeholder{
            color:#cccccc;
        }
        input::-moz-placeholder{   /* Mozilla Firefox 19+ */
            color:#cccccc;
        }
        input:-moz-placeholder{    /* Mozilla Firefox 4 to 18 */
            color:#cccccc;
        }
        input:-ms-input-placeholder{  /* Internet Explorer 10-11 */ 
            color:#cccccc;
        }
        
   #reveal-left {
    background: url(/static/template/mobile/index/img/zhuce_fh.png) no-repeat;
    background-size: 42.5px;
    height: 44px;
    width: 42.5px;
    height: 44px;
    display: block;
    border: none;
    background-size: 25px;
}
.ui-toolbar-left {
     background: none; 
     padding-top: 6px;
     padding-left: 6px;
}

.yzm_b::-webkit-input-placeholder{
            color:#888;
        }
        .yzm_b::-moz-placeholder{   /* Mozilla Firefox 19+ */
            color:#888;
        }
        .yzm_b:-moz-placeholder{    /* Mozilla Firefox 4 to 18 */
            color:#888;
        }
      .yzm_b:-ms-input-placeholder{  /* Internet Explorer 10-11 */ 
            color:#888;
        }
        
        .yhxy_b{
        	display: block;
        }
        .yhxy_n{
        	display: none;
        }
</style>

<body>
	<div id="ji" style="width:250px;height:40px;position:fixed;top:0;right:0;left:0;bottom:0;margin:auto;opacity: .7;background: #000;border-radius: 4px;display:none;z-index:1111;">
	<div style="width:200px;height:40px;line-height:40px;text-align:center;
	position:absolute;top:0;font-size:12px;right:0;left:0;bottom:0;margin:auto;color:#fff;z-index: 11112;"></div>
</div>
 
<!--<div class="login_bg" style="background:url(/static/attachment/{$login_bj.gg_img});background-size: 100% 100%;">
<div class="logo"></div></div>-->
<div id="" style="height: 44px;width: 100%;">
	 <div class="ui-toolbar-left">
            <button id="reveal-left" onClick="window.history.go(-1);"></button>
        </div>
        <div id="" style="display: inline-block;width: 72px;height: 44px;margin-left: 44%;color: #333;text-align: center;line-height: 44px;font-size: 18px;">
        	免费注册
        </div>
        
       <!-- <div style="display: inline-block;float: right;color: white;font-size: 14px;line-height: 45px;margin-right: 8px;"><a href="" id="sw" style="color: white;">免费试玩</a></div>-->
       <!--<a id="sw" href="javascript:;"><div style="display: inline-block;float: right;color: #333;font-size: 14px;line-height: 45px;margin-right: 8px;">免费试玩</div></a>-->
</div>

 <div id="tsk">
  <p id="tsy"></p>
    <div id="ts">确定</div>
</div>
<div class="biaoda1" style="margin-top: 10px;">
  <div class="biaoda_input">
  <form method="post" action="" enctype="application/x-www-form-urlencoded">
  	
    <div class="login_input">
	<div style="float: left;width: 12%;font-size: 15px;line-height: 42px;">
		账&nbsp;&nbsp;号
	</div>
	  <div class="tb_input"><input name="reg_user"  id="reg_user" type="text" placeholder="（不含中文,长度为6~16的字母或数字）" style=""/></div>
	</div>
	<div class="login_input ind">
	<div style="float: left;width: 12%;font-size: 15px;line-height: 42px;">
		密&nbsp;&nbsp;码
	</div>
	  <div class="tb_input"><input name="reg_pass" id="reg_pass" type="password" placeholder="（字母开头,长度6~12,只包含数字字母下划线）" /></div>
	</div>
	
	<div class="login_input ind">
	 <div style="float: left;width: 19%;font-size: 15px;line-height: 42px;">
		手机号
	</div>
	  <div class="tb_input" style="width: 80%;"><input name="reg_phone" id="reg_phone" type="number" placeholder="请输入手机号（选填）"/></div>
	</div>


    <div class="login_input ind " style="display:block;border-bottom: none;">
	   <div style="float: left;width: 19%;font-size: 15px;line-height: 42px;">
		推荐码
	</div>
	  <div class="tb_input" style="width: 80%;"><input name="reg_recommend" id="reg_recommend" type="text" value="{$tjm}" placeholder="请输入推荐码{if condition='$tjm_open eq 1'} （必填）{else /} （选填）{/if}"/></div>
	</div>
	<input type="hidden" value="{$code_open}" id="yz_code"  />
	<input type="hidden" value="{$tjm_open}" id="tjm_code"  />
	 {if condition="$code_open eq 1"}
        <div class="login_input ind" style="display:block;border-bottom: none;">
     {else /}
        <div class="login_input ind" style="display:none;border-bottom: none;">
     {/if}
   
	  <div class="tb_input" style="width: 55%;margin-right: 15px;"><input class="yzm_b" style="background-color: #eeeeee;border-radius: 3px;" name="verify_code" id="verify_code" type="text" placeholder="请输入验证码"/></div>
	  <div style="display: inline-block;width: 40%;"><img style="height: 43px;" id="verify_img" alt="captcha" src="{:url('Index/verify')}" onclick="refreshVerify()" /></div>
	</div>
	
	
	<div style="margin-top: 20px;font-size: 12px;height: 10px;">
		<p style="float: right;"><a href="#" style="color: #666;">已有账号？</a><a href="{:url('user/login')}" style="color: #ec0909;">立即登录</a></p>
	</div>
	
	<div style="margin-top: 25px;font-size: 12px;height: 10px;text-align: center;margin-bottom: 15px;">
		<p style="color: #666;position: relative;"><span class="yhxy_s" style="width: 15px;height: 15px;margin-right:5px;display: inline-block;border: 1px solid #ccc;text-align: center;position: relative;top: 3px;background-color: white;border-radius: 3px;"><img class="yhxy_t yhxy_b" src="__TEMPLATE__/mobile/index/img/xzdg.png"/></span>我已经满合法博彩年龄,且同意各项开户条约,<a href="{:url('user/agreement')}" style="color: #ec0909;">“开户协议”</a></p>
	</div>
	<div class="ti_nr" style="display:none;width: 131px;height: 40px;background-color: black;opacity: 0.7;font-size: 14px;color: white;text-align: center;line-height: 40px;border-radius: 5px;position: fixed;top: 50%;left: 32%;"></div>
	<div class="ti_nr" style="display:none;width: 131px;height: 40px;background-color: black;opacity: 0.7;font-size: 14px;color: white;text-align: center;line-height: 40px;border-radius: 5px;position: fixed;top: 50%;left: 32%;">请先勾选用户协议</div>
<div class="login_input ind" id="register" style="margin-top: 40px;"><input type="button" class="sudg" value="立即注册" style="background:#ec112c"></div>
	
	<div style="clear:both"></div>
  </form>
  </div>
  <div style="clear:both"></div>
</div>
<div class="footer" style="color:#FF0000; font-size:16px">蚂蚁赢彩网版权所有</div>

</div>
</body>
</html>

<script type="text/javascript">
	$('.yhxy_s').click(function(){
//	$('.yhxy_t').toggle();

	if($('.yhxy_t').hasClass('yhxy_b')){
		$('.yhxy_t').removeClass('yhxy_b').addClass('yhxy_n');
	}else{
		$('.yhxy_t').removeClass('yhxy_n').addClass('yhxy_b');
	}
})
</script>
<script>
  var user_register=1
  $('#register').click(function(){
        if($('#reg_user').val()==''){
        	$('#reg_user').attr('placeholder','用户名不能为空')
        	$('#reg_user').addClass('change_h')
        	$('#reg_user').removeClass('change_q')
        	return
        }else{
        	$('#reg_user').attr('placeholder','用户名')
        	$('#reg_user').removeClass('change_h')
        	$('#reg_user').addClass('change_q')
        }
        if($('#reg_pass').val()==''){
        	$('#reg_pass').attr('placeholder','密码不能为空')
        	$('#reg_pass').addClass('change_h')
        	$('#reg_pass').removeClass('change_q')
        	return
        }else{
        	$('#reg_pass').attr('placeholder','密码')
        	$('#reg_pass').removeClass('change_h')
        	$('#reg_pass').addClass('change_q')
        }
        /* if($('#reg_phone').val()==''){
        	$('#reg_phone').attr('placeholder','手机号不能为空')
        	$('#reg_phone').addClass('change_h')
        	$('#reg_phone').removeClass('change_q')
        	return
        }else{
        	$('#reg_phone').attr('placeholder','手机号')
        	$('#reg_phone').removeClass('change_h')
        	$('#reg_phone').addClass('change_q')
        } */
       if($('#yz_code').val()==1){
       	    if($('#verify_code').val()==''){
	        	$('#verify_code').attr('placeholder','验证码不能为空')
	        	$('#verify_code').addClass('change_h')
	        	$('#verify_code').removeClass('change_q')
	           return
	        }else{
	        	$('#verify_code').attr('placeholder','验证码')
	        	$('#verify_code').removeClass('change_h')
	        	$('#verify_code').addClass('change_q')
	        }
       }
       
       	if($('.yhxy_t').hasClass('yhxy_n')){
  		$('.ti_nr').css('display','block');
  		setTimeout(function(){
            $('.ti_nr').css('display','none')
        },2000);
		return
  	}
    var str_reg_pass=/^[a-zA-Z][a-zA-Z0-9]{6,16}$/;
    var str_reg_user=/^[a-zA-Z0-9]{6,16}$/
    var str_reg_phone=/^((\d3)|(\d{3}\-))?1[3|4|5|6|7|8|9][0-9]\d{8}$/ ;
    var reg_user=$('#reg_user').val()
    var reg_pass=$('#reg_pass').val()
    var verify_code=$('#verify_code').val()
    var reg_phone=$('#reg_phone').val()
    var reg_recommend=$.trim($('#reg_recommend').val());
    
    if(str_reg_pass.test(reg_pass)){
    	$('#reg_pass').attr('placeholder','用户名（长度为6~16的字母或数字）')
	    $('#reg_pass').addClass('change_h')
	    $('#reg_pass').removeClass('change_q')
    }else{
    	 $('#reg_pass').addClass('change_q')
	    $('#reg_pass').removeClass('change_h')
    }
    if(reg_phone!=''){
    	if(str_reg_phone.test(reg_phone)){
	    	$('#reg_phone').attr('placeholder','无效手机号')
		    $('#reg_phone').addClass('change_h')
		    $('#reg_phone').removeClass('change_q')
	    }else{
	    	 $('#reg_phone').addClass('change_q')
		    $('#reg_phone').removeClass('change_h')
	    }
    }
  
    if(reg_user==''&&reg_pass==''){
    	
    }else{
    	if(user_register==2) return;
    	user_register=2
        $.ajax({
          type:'POST',
          url:"{:url('User/regVerify')}",
          data:{
            'reg_user':reg_user,'reg_pass':reg_pass,'verify_code':verify_code,'reg_phone':reg_phone,'reg_recommend':reg_recommend
          },
          success:function(data){
            if(data=='ok'){
              window.location.href="{:url('user/login')}";
            }else if(data=='2'){
				$('#ji').css('display','block')
		        	$('#ji div').html('对不起您今天注册的会员账号过多')
		          setTimeout(function(){
		       	     $('#ji').css('display','none')
		       	     user_register=1
		           },2000)
            }else if(data=='3'){
		        $('#reg_user').val('')
                $('#reg_user').attr('placeholder','用户名（长度为6~16的字母或数字）')
        	    $('#reg_user').addClass('change_h')
        	    $('#reg_user').removeClass('change_q')
        	    user_register=1

            }else if(data=='4'){
                $('#reg_pass').val('')
                $('#reg_pass').attr('placeholder','密码（字母开头,只包含数字字母下划线）')
        	    $('#reg_pass').addClass('change_h')
        	    $('#reg_pass').removeClass('change_q')
        	    user_register=1
        	   
            	
    
            }else if(data=='5'){
                $('#reg_user').val('')
                $('#reg_user').attr('placeholder','此账号已存在')
        	    $('#reg_user').addClass('change_h')
        	    $('#reg_user').removeClass('change_q')
        	    user_register=1

            }else if(data=='6'){
                $('#verify_code').val('')
                $('#verify_code').attr('placeholder','验证码无效')
        	    $('#verify_code').addClass('change_h')
        	    $('#verify_code').removeClass('change_q')
        	    user_register=1
            } else if(data=='7'){
            	$('#reg_phone').val('')
                $('#reg_phone').attr('placeholder','无效的手机号')
        	    $('#reg_phone').addClass('change_h')
        	    $('#reg_phone').removeClass('change_q')
        	    user_register=1
            } else if(data=='8'){
              $('#reg_recommend').val('')
              $('#reg_recommend').attr('placeholder','推荐码无效')
        	  $('#reg_recommend').addClass('change_h')
        	  $('#reg_recommend').removeClass('change_q')
        	  $("#reg_recommend").blur(function(){
                    $(this).attr('placeholder','推荐码')
                    $(this).addClass('change_q')
                    user_register=1
			  })
        	  user_register=1
            }else if(data=='9'){
                $('#reg_recommend').val('')
                $('#reg_recommend').attr('placeholder','推荐码必填')
                $('#reg_recommend').addClass('change_h')
                $('#reg_recommend').removeClass('change_q')
                $("#reg_recommend").blur(function(){
                    $(this).attr('placeholder','推荐码')
                    $(this).addClass('change_q')
                    user_register=1
                })
                user_register=1
            }
          $("#verify_code").val('');
               refreshVerify();
          
          }
      })
    }
    

  })

  $('#ts').click(function(){
    $('#tsk').css('display','none')
    window.location.href="{:url('user/register')}";
  })
 $("#reg_user").blur(function(){
  	   if($(this).val()==''){
        	$(this).attr('placeholder','用户名不能为空')
        	$(this).addClass('change_h')
        	$(this).removeClass('change_q')
        	
        }else{
        	$(this).attr('placeholder','用户名（不含中文,长度为6~16的字母或数字）')
        	$(this).removeClass('change_h')
        	$(this).addClass('change_q')
        }
     
    })

  	$("#reg_pass").blur(function(){
  	   if($(this).val()==''){
        	$(this).attr('placeholder','密码不能为空')
        	$(this).addClass('change_h')
        	$(this).removeClass('change_q')
        	
        }else{
        	$(this).attr('placeholder','密码（字母开头,长度为6~16的字母或数字）')
        	$(this).removeClass('change_h')
        	$(this).addClass('change_q')
        }
     
    })
 
  

  /* $("#reg_phone").blur(function(){
  	   
  	   if($(this).val()==''){
        	$(this).attr('placeholder','手机号不能为空')
        	$(this).addClass('change_h')
        	$(this).removeClass('change_q')
        	
        }else{
        	$(this).attr('placeholder','手机号')
        	$(this).removeClass('change_h')
        	$(this).addClass('change_q')
        }
     
    })

  */
  if($('#yz_code').val()==1){
     $("#verify_code").blur(function(){
  	   
  	   if($(this).val()==''){
        	$(this).attr('placeholder','验证码不能为空')
        	$(this).addClass('change_h')
        	$(this).removeClass('change_q')
        	
        }else{
        	$(this).attr('placeholder','验证码')
        	$(this).removeClass('change_h')
        	$(this).addClass('change_q')
        }
     
    })

 }
  
  
  
  if($('#tjm_code').val()==1){
     $("#verify_code").blur(function(){
  	   if($(this).val()==''){
        	$(this).attr('placeholder','推荐码不能为空')
        	$(this).addClass('change_h')
        	$(this).removeClass('change_q')
        	
        }else{
        	$(this).attr('placeholder','推荐码')
        	$(this).removeClass('change_h')
        	$(this).addClass('change_q')
        }
     
    })

 }
  
  $('#reg_pass_con').on('click',function(){
	var _this = this;
	setTimeout(function(){
		_this.scrollIntoView(true);
	},100);
  })
  
  $('#reg_phone').on('click',function(){
	var _this = this;
	setTimeout(function(){
		_this.scrollIntoView(true);
	},100);
  })
  
//  $('#reg_recommend').on('click',function(){
//	var _this = this;
//	setTimeout(function(){
//		_this.scrollIntoView(true);
//	},100);
//  })

//免费试玩
   $('#sw').click(function(){
	  $.ajax({
                type: "GET",
         url: "{:url('pocessing/shiwan')}",
         success: function (data) {
                 if(data=='sw') {
                  $('#tsk').css('display','block')
                    $('#tsy').html('申请成功！')
                    $('#ts').click(function(){
                        $('#tsk').css('display','none')
                        window.location.href = "/mobile/index/mhome";
                    })
                }else{
               	  $('#tsk').css('display','block')
                  $('#tsy').html('系统未开启试玩功能！')
                  $('#ts').click(function(){
                    $('#tsk').css('display','none')
                        
                  })
                }
       }
     })
   	
   })
   
   
   //刷新验证码
function refreshVerify() {
    var ts = Date.parse(new Date()) / 1000;
    $('#verify_img').attr("src", "{:url('Index/verify')}?id="+ts);
}


</script>
